IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetVFAPDFBlob]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetVFAPDFBlob]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
        
CREATE PROCEDURE [dbo].[GetVFAPDFBlob]      
(      
	@protocolProcessId int  ,
    @protocolId      int,
    @type varchar(50)        
)        
AS        
BEGIN        
 SET NOCOUNT ON        
        
 SELECT Blob        
 FROM dbo.VFADocument       
 WHERE ProtocolProcessId = @protocolProcessId    
 AND   ProtocolId = @protocolId
 AND   LTRIM(RTRIM(Type))= LTRIM(RTRIM(@type))        
        
 SET NOCOUNT OFF        
END   
GO
